﻿using DTOs;
using MediatR;
using RBAC.Domain;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.UserCommand;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.UserHanders
{
    public class UserShowCommandHandler : IRequestHandler<UserShowCommand, PageDto<UserDto>>
    {
        private readonly IUserService _userService;
        public UserShowCommandHandler(IUserService userService)
        {
            _userService = userService;
        }

        public async Task<PageDto<UserDto>> Handle(UserShowCommand request, CancellationToken cancellationToken)
        {
            return await _userService.GetAll(request.pageSize,request.pageIndex);
        }
    }
}
